Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Mailcow API 2024-08a #349

Merged
merged 3 commits into from
Sep 15, 2024
Merged

Update Mailcow API 2024-08a #349

merged 3 commits into from
Sep 15, 2024

Conversation

EricTRL
Copy link
Contributor

@EricTRL EricTRL commented Sep 15, 2024

Mailcow's API was changed in one of the recent updates that we applied to our installation. This changes the way Squire handles the API:

  • More robust: Squire will no longer crash when the MailCow API returns an unexpected item, or does not return an expected item. This won't prevent Squire from crashing from breaking API-changes, but will prevent issues like the one we've seen in this Mailcow update.
  • API and Squire-dataclass mismatches are reported in squire/logs/squire.log. This log can be viewed from the server status tabs. Warnings are written to this file when:
    • Additional fields are returned by the MailCow API, but were not expected when Squire
    • Fields are expected by Squire('s dataclass), but not returned by the Mailcow API
    • A field value returned by the Mailcow API cannot be parsed in the expected format (e.g. Squire expects a boolean but '3' was returned)
  • The logfile is highlighted when viewed in Squire
Screenshot

image

Multiple mailbox-related fields were added between the previous Mailcow installation and the latest one. This adds the missing ones.
Failed parsing of mailcow API responses no longer throws a 500 error. Instead the relevant entry (mailbox, alias, etc.) is ignored.
Reversed the order of log entries.

Added proper validation for Mailcow responses. If extra fields are passed, or optional fields are missing, then Squire will operate as usual and only log a warning message.

Updated tests to reflect Mailcow's API changes.
@EricTRL EricTRL added bug Something isn't working emails Related to sending and receiving emails labels Sep 15, 2024
Copy link

codecov bot commented Sep 15, 2024

Codecov Report

Attention: Patch coverage is 62.59542% with 98 lines in your changes missing coverage. Please review.

Project coverage is 96.57%. Comparing base (02b3f6b) to head (5398d42).

Files with missing lines Patch % Lines
core/admin_status/views.py 28.00% 36 Missing ⚠️
mailcow_integration/api/interface/base.py 68.23% 20 Missing and 7 partials ⚠️
mailcow_integration/api/interface/mailbox.py 68.75% 10 Missing and 10 partials ⚠️
mailcow_integration/api/interface/alias.py 56.66% 7 Missing and 6 partials ⚠️
mailcow_integration/squire_mailcow.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #349      +/-   ##
==========================================
- Coverage   97.19%   96.57%   -0.63%     
==========================================
  Files         234      236       +2     
  Lines       14332    14564     +232     
  Branches      906      945      +39     
==========================================
+ Hits        13930    14065     +135     
- Misses        261      334      +73     
- Partials      141      165      +24     
Flag Coverage Δ
unittests 96.57% <62.59%> (-0.63%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EricTRL EricTRL merged commit 88e18e8 into master Sep 15, 2024
4 of 8 checks passed
@EricTRL EricTRL deleted the hotfix/mailcow-202408a branch September 15, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working emails Related to sending and receiving emails
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants